package com.jiangSheng.mall.app.services.impl;

import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jiangSheng.mall.app.bean.Users;
import com.jiangSheng.mall.app.dao.UserDao;
import com.jiangSheng.mall.app.services.UserServices;

@Transactional
@Service
public class UserServicesImpl implements UserServices{
	
	@Autowired
	private UserDao userDao;
	
	@Override
	public Object listPage(HashMap<String, Object> map) {
		// TODO Auto-generated method stub
		return userDao.listPage(map);
	}

	@Override
	public Object count(Object object) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Users getUser() {
		SecurityContext ctx = SecurityContextHolder.getContext();
		Authentication auth = ctx.getAuthentication();
		Users user = (Users) auth.getPrincipal();
		return user;
	}

}
